<!--
 * @Date: 2023-03-06 13:38:03
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-03-30 14:47:44
 * @FilePath: \qingjiu\src\components\component\floorComponent.vue
-->
<template>
  <div>
    <!--floor one area-->
    <div class="floor">
      <div class="floor-title">
        {{ floorTitle }}
      </div>
      <div class="floor-anomaly">
        <div class="floor-one">
          <img
            :src="floorData0.image"
            width="100%"
            @click="goGoods(floorData0)"
          />
        </div>
        <div>
          <div class="floor-two">
            <img
              :src="floorData1.image"
              width="100%"
              @click="goGoods(floorData1)"
            />
          </div>
          <div>
            <img
              :src="floorData2.image"
              width="100%"
              @click="goGoods(floorData2)"
            />
          </div>
        </div>
      </div>

      <div class="floor-rule">
        <div v-for="(item, index) in floorData.slice(3)" :key="index">
          <img :src="item.image" width="100%" />
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="js">
import { toMoney } from '@/filter/moneyFilter.js'
export default {
    props:[
        'floorData',
        'floorTitle'
    ],
    data() {
        return {
            floorData0: {},
            floorData1: {},
            floorData2: {},
        }
    },
    created() {

    },
    watch: {
        floorData: function (val) {
            console.log(this.floorData);
            this.floorData0 = this.floorData[0]
            this.floorData1 = this.floorData[1]
            this.floorData2 = this.floorData[2]
        }
    },
    filters: {
        moneyFilter(money) {
            return toMoney(money)
        }
    },
    methods: {
      goGoods(floorData) {
        console.log(floorData.goodsId, 'floorComponent页面');
        this.$router.push({path: '/goods', query: {goodsId: floorData.goodsId}})
      }
    }
}
</script>

<style scoped>
.floor-anomaly {
  display: flex;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
}
.floor-anomaly div {
  flex: 1;
  box-sizing: border-box;
}
.floor-one {
  border-right: 1px solid #ddd;
}
.floor-two {
  border-bottom: 1px solid #ddd;
}
.floor-rule {
  display: flex;
  flex-wrap: wrap;
  background: #fff;
}
.floor-rule div {
  box-sizing: border-box;
  flex: 1;
  border-bottom: 1px solid #ddd;
}
.floor-rule div:nth-child(odd) {
  border-right: 1px solid #ddd;
}
.floor-title {
  text-align: left;
  font-size: 14px;
  height: 1.8rem;
  line-height: 1.8rem;
  color: #e5017d;
  border-bottom: 1px solid #ddd;
}
</style>
